home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / stay42.zip / STAYRSTR.420 < prev    next >
Text File  |  1986-08-06  |  4KB  |  67 lines

  1. Inline(
  2.                               {;****************************************************************************;}
  3.                               {;                  S  T  A  Y  R  S  T  R  .  I  N  C                        ;}
  4.                               {;                                                                            ;}
  5.                               {;           This is the StayRstr.Inc file included above                     ;}
  6.                               {;****************************************************************************;}
  7.                               {;Version 4.15}
  8.                               {      ; Inline Code to restore the stack and regs moved}
  9.                               {      ; to the Turbo Resident Stack which allows}
  10.                               {      ; Turbo Terminate & Stay Resident programs.}
  11.                               {      ; Copr. 1985, 1986}
  12.                               {      ; Author: Lane Ferris}
  13.                               {      ;       - The Hunter's Helper -}
  14.                               {      ; Distributed to the Public Domain for use without profit.}
  15.                               {      ; Original Version 5.15.85}
  16.                               {;----------------------------------------------------------------------;}
  17.                               {;        Restore the Dos (or interrupted pgm) Regs and Stack           ;}
  18.                               {;----------------------------------------------------------------------;}
  19.                               {; Replace the Users Saved Stack}
  20.                               {; Note that pushes on the stack go in the opposite direction of our}
  21.                               {; moves. Thus we dont worry about REP stack activity overlaying the}
  22.                               {; enabled REP fuction.}
  23.   $FA                         {    CLI}
  24.   /$2E                        {    CS:     ;Avoid stack manipulation if never "StaySaved"}
  25.   /$A1/>DOSSSIZ               {    Mov  Ax,[>DosSsiz]}
  26.   /$09/$C0                    {    Or   Ax,Ax}
  27.   /$74/$20                    {    Jz   NotinDos}
  28.   /$8C/$D0                    {    Mov  Ax,SS         ;Source is our Stack}
  29.   /$8E/$D8                    {    Mov  DS,Ax}
  30.   /$89/$E6                    {    Mov  Si,Sp         ;Point to Last used USER word on our stack}
  31.   /$46                        {    Inc  Si}
  32.   /$46                        {    Inc  Si}
  33.   /$2E                        {    CS:}
  34.   /$8E/$06/>DOSSSEG           {    Mov  ES,[>DosSSeg] ;Dest is Dos indos primary Stack}
  35.   /$2E                        {    CS:}
  36.   /$8B/$3E/>DOSSPTR           {    Mov  Di,[>DosSptr]}
  37.   /$2E                        {    CS:}
  38.   /$8B/$0E/>DOSSSIZ           {    Mov  Cx,[>DosSsiz] ;Saved words}
  39.   /$29/$CF                    {    Sub  Di,Cx         ;point to last used word of Dos stack}
  40.   /$29/$CF                    {    Sub  Di,Cx}
  41.   /$FC                        {    CLD}
  42.   /$F2/$A5                    {    Rep Movsw          ;Careful! Interrupt are enabled here}
  43.   /$89/$F4                    {    Mov  Sp,Si         ;Skip over moved words}
  44.                               {;--}
  45.                               {NotinDos:}
  46.   /$07                        {    Pop  Es}
  47.   /$5F                        {    Pop  Di}
  48.   /$5E                        {    Pop  Si}
  49.   /$5A                        {    Pop  Dx}
  50.   /$59                        {    Pop  Cx}
  51.   /$5B                        {    Pop  Bx}
  52.   /$58                        {    Pop  Ax}
  53.   /$2E                        {    CS:}
  54.   /$80/$26/>STATUS/<FOXS-INUSE-HOTKEY_ON{    And by [<Status],<Foxs-Inuse-HotKey_on   ; Clear INUSE flag}
  55.   /$2E                        {    CS:                                        ; .. and HotKey}
  56.   /$8E/$1E/>USRDSEG           {    Mov  DS,[<UsrDSeg]}
  57.   /$2E                        {    CS:}
  58.   /$8E/$16/>USRSSEG           {    Mov  SS,[<UsrSSeg]}
  59.   /$2E                        {    CS:}
  60.   /$8B/$26/>USRSPTR           {    Mov  SP,[<UsrSPtr]}
  61.   /$5D                        {    Pop  Bp            ; Remove Bp,Sp from Procedure entry}
  62.   /$5D                        {    Pop  Bp}
  63.   /$FB                        {    STI                ; enable interrupts}
  64.   /$C3                        {    RET}
  65.                               {;.......................................................................}
  66. );
  67.